<?php
/**
 *
 * Copyright (c) 2009, Persistent Systems Limited
 *
 * Redistribution and use, with or without modification, are permitted
 *  provided that the following  conditions are met:
 *   - Redistributions of source code must retain the above copyright notice,
 *     this list of conditions and the following disclaimer.
 *   - Neither the name of Persistent Systems Limited nor the names of its contributors
 *     may be used to endorse or promote products derived from this software
 *     without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**
 * This code was generated by the tool 'PHPDataSvcUtil.php'.
 * Runtime Version:1.0
 *
 * Changes to this file may cause incorrect behavior and will be lost if
 * the code is regenerated.
 */

// Get ADO .NET Data Services PHP Toolkit library path
$library_path = get_cfg_var('adodotnetservicesphp_path');
if (strlen($library_path) == 0)
{
    throw new Exception("The configuration option 'adodotnetservicesphp_path' is not set in the php.ini file, "
                        . "Please refer installation instructions for fix this issue");
}

// Refer phpdataservices framework classes
require_once 'Resource/Messages.php';
require_once 'Common/Dictionary.php';
require_once 'Context/EntityStates.php';
require_once 'Interfaces/Entity.php';
require_once 'Context/ResourceBox.php';
require_once 'Context/RelatedEnd.php';
require_once 'Context/SaveResult.php';
require_once 'Common/Guid.php';
require_once 'Credential/Credential.php';
require_once 'Common/Utility.php';
require_once 'Context/QueryProcessor.php';
require_once 'Context/ObjectContext.php';
require_once 'Parser/Parser.php';
require_once 'Parser/AtomParser.php';
require_once 'Parser/JSONParser.php';
require_once 'Interfaces/Object.php';
require_once 'WebUtil/HttpBatchRequest.php';
require_once 'WebUtil/HttpBatchResponse.php';
require_once 'WebUtil/HttpRequest.php';
require_once 'WebUtil/Microsoft_Http_Response.php';
require_once 'WebUtil/HttpResponse.php';
require_once 'HttpProxy.php';
require_once 'ADODotNETDataServicesException.php';

/**
 * Defines default ADO .NET Data Service URL for this proxy class
 */
define("DEFAULT_ADO_DOT_NET_SERVICE_URL", "http://localhost:8080/VideoGameStoreDataService.svc/");

/**
 * The Accessory class
 */
class Accessory extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $ProductID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $SystemName;
    /**
     * NavigationProperty
     */
    public $Product;

    /**
     * Function to create an instance of Accessory
     */
    public static function CreateAccessory($ProductID, $SystemName)
    {   
        $Accessory = new Accessory();
        $Accessory->ProductID = $ProductID;
        $Accessory->SystemName = $SystemName;
        return $Accessory;
    }

    /**
     * Constructor for Accessory
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Product'] = 'Product';
        
        $this->_entityKey[] = 'ProductID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The Console class
 */
class Console extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $ProductID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $DriveType;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Double
     */
    public $DriveSize;
    /**
     * EntityProperty
     * Edm.String
     */
    public $ConsoleDetails;
    /**
     * NavigationProperty
     */
    public $Product;

    /**
     * Function to create an instance of Console
     */
    public static function CreateConsole($ProductID, $DriveType, $DriveSize)
    {   
        $Console = new Console();
        $Console->ProductID = $ProductID;
        $Console->DriveType = $DriveType;
        $Console->DriveSize = $DriveSize;
        return $Console;
    }

    /**
     * Constructor for Console
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Product'] = 'Product';
        
        $this->_entityKey[] = 'ProductID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The Customer class
 */
class Customer extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $CustomerID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $CustomerName;
    /**
     * EntityProperty
     * Edm.String
     */
    public $CustomerAddress;
    /**
     * EntityProperty
     * Edm.String
     */
    public $CustomerDetails;
    /**
     * EntityProperty
     * Edm.Guid
     */
    public $CustomerMembershipId;
    /**
     * NavigationProperty
     */
    public $Purchase;

    /**
     * Function to create an instance of Customer
     */
    public static function CreateCustomer($CustomerID, $CustomerName)
    {   
        $Customer = new Customer();
        $Customer->CustomerID = $CustomerID;
        $Customer->CustomerName = $CustomerName;
        return $Customer;
    }

    /**
     * Constructor for Customer
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Purchase'] = 'Purchase';
        
        $this->_entityKey[] = 'CustomerID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The Game class
 */
class Game extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $ProductID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $SystemName;
    /**
     * EntityProperty
     * Edm.String
     */
    public $Rating;
    /**
     * EntityProperty
     * Edm.String
     */
    public $Genre;
    /**
     * EntityProperty
     * Edm.String
     */
    public $Publisher;
    /**
     * EntityProperty
     * Edm.String
     */
    public $Developer;
    /**
     * EntityProperty
     * Edm.String
     */
    public $RatingUrl;
    /**
     * EntityProperty
     * Edm.String
     */
    public $PlayerInfo;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Binary
     */
    public $GameVersion;
    /**
     * NavigationProperty
     */
    public $Product;

    /**
     * Function to create an instance of Game
     */
    public static function CreateGame($ProductID, $SystemName, $GameVersion)
    {   
        $Game = new Game();
        $Game->ProductID = $ProductID;
        $Game->SystemName = $SystemName;
        $Game->GameVersion = $GameVersion;
        return $Game;
    }

    /**
     * Constructor for Game
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Product'] = 'Product';
        
        $this->_entityKey[] = 'ProductID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The Product class
 */
class Product extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $ProductID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $ProductName;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $ProductDescription;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Double
     */
    public $ListPrice;
    /**
     * EntityProperty
     * Edm.DateTime
     */
    public $ReleaseDate;
    /**
     * EntityProperty
     * Edm.String
     */
    public $ProductImageUrl;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $ListPriceCurrency;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Binary
     */
    public $ProductVersion;
    /**
     * NavigationProperty
     */
    public $Accessory;
    /**
     * NavigationProperty
     */
    public $Console;
    /**
     * NavigationProperty
     */
    public $Game;
    /**
     * NavigationProperty
     */
    public $ProductType;
    /**
     * NavigationProperty
     */
    public $Supplier;
    /**
     * NavigationProperty
     */
    public $PurchaseItem;

    /**
     * Function to create an instance of Product
     */
    public static function CreateProduct($ProductID, $ProductName, $ProductDescription, $ListPrice, $ListPriceCurrency, $ProductVersion)
    {   
        $Product = new Product();
        $Product->ProductID = $ProductID;
        $Product->ProductName = $ProductName;
        $Product->ProductDescription = $ProductDescription;
        $Product->ListPrice = $ListPrice;
        $Product->ListPriceCurrency = $ListPriceCurrency;
        $Product->ProductVersion = $ProductVersion;
        return $Product;
    }

    /**
     * Constructor for Product
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Accessory'] = 'Accessory';
        
        $this->_entityMap['Console'] = 'Console';
        
        $this->_entityMap['Game'] = 'Game';
        
        $this->_entityMap['ProductType'] = 'ProductType';
        
        $this->_entityMap['Supplier'] = 'Supplier';
        
        $this->_entityMap['PurchaseItem'] = 'PurchaseItem';
        
        $this->_entityKey[] = 'ProductID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The ProductType class
 */
class ProductType extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $ProductTypeID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $ProductTypeName;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $ProductTypeDescription;
    /**
     * NavigationProperty
     */
    public $Product;

    /**
     * Function to create an instance of ProductType
     */
    public static function CreateProductType($ProductTypeID, $ProductTypeName, $ProductTypeDescription)
    {   
        $ProductType = new ProductType();
        $ProductType->ProductTypeID = $ProductTypeID;
        $ProductType->ProductTypeName = $ProductTypeName;
        $ProductType->ProductTypeDescription = $ProductTypeDescription;
        return $ProductType;
    }

    /**
     * Constructor for ProductType
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Product'] = 'Product';
        
        $this->_entityKey[] = 'ProductTypeID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The Purchase class
 */
class Purchase extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $PurchaseID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.DateTime
     */
    public $PurchaseDate;
    /**
     * EntityProperty
     * Edm.String
     */
    public $Details;
    /**
     * NavigationProperty
     */
    public $Customer;
    /**
     * NavigationProperty
     */
    public $PurchaseItem;

    /**
     * Function to create an instance of Purchase
     */
    public static function CreatePurchase($PurchaseID, $PurchaseDate)
    {   
        $Purchase = new Purchase();
        $Purchase->PurchaseID = $PurchaseID;
        $Purchase->PurchaseDate = $PurchaseDate;
        return $Purchase;
    }

    /**
     * Constructor for Purchase
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Customer'] = 'Customer';
        
        $this->_entityMap['PurchaseItem'] = 'PurchaseItem';
        
        $this->_entityKey[] = 'PurchaseID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The PurchaseItem class
 */
class PurchaseItem extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $PurchaseItemID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Decimal
     */
    public $Price;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $Quantity;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Double
     */
    public $Discount;
    /**
     * NavigationProperty
     */
    public $Product;
    /**
     * NavigationProperty
     */
    public $Purchase;

    /**
     * Function to create an instance of PurchaseItem
     */
    public static function CreatePurchaseItem($PurchaseItemID, $Price, $Quantity, $Discount)
    {   
        $PurchaseItem = new PurchaseItem();
        $PurchaseItem->PurchaseItemID = $PurchaseItemID;
        $PurchaseItem->Price = $Price;
        $PurchaseItem->Quantity = $Quantity;
        $PurchaseItem->Discount = $Discount;
        return $PurchaseItem;
    }

    /**
     * Constructor for PurchaseItem
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Product'] = 'Product';
        
        $this->_entityMap['Purchase'] = 'Purchase';
        
        $this->_entityKey[] = 'PurchaseItemID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The Supplier class
 */
class Supplier extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $SupplierID;
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $SupplierName;
    /**
     * EntityProperty
     * Edm.String
     */
    public $SupplierAddress;
    /**
     * EntityProperty
     * Edm.String
     */
    public $SupplierPhone;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Binary
     */
    public $SupplierVersion;
    /**
     * NavigationProperty
     */
    public $Product;

    /**
     * Function to create an instance of Supplier
     */
    public static function CreateSupplier($SupplierID, $SupplierName, $SupplierVersion)
    {   
        $Supplier = new Supplier();
        $Supplier->SupplierID = $SupplierID;
        $Supplier->SupplierName = $SupplierName;
        $Supplier->SupplierVersion = $SupplierVersion;
        return $Supplier;
    }

    /**
     * Constructor for Supplier
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityMap['Product'] = 'Product';
        
        $this->_entityKey[] = 'SupplierID';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}

/**
 * The sysdiagrams class
 */
class sysdiagrams extends Object
{
    protected $_entityMap = array();
    protected $_entityKey = array();
    protected $_relLinks  = array();
    protected $_baseURI;
    
    /**
     * EntityProperty
     * NotNullable
     * Edm.String
     */
    public $name;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $principal_id;
    /**
     * EntityProperty
     * NotNullable
     * Edm.Int32
     */
    public $diagram_id;
    /**
     * EntityProperty
     * Edm.Int32
     */
    public $version;
    /**
     * EntityProperty
     * Edm.Binary
     */
    public $definition;

    /**
     * Function to create an instance of sysdiagrams
     */
    public static function Createsysdiagrams($name, $principal_id, $diagram_id)
    {   
        $sysdiagrams = new sysdiagrams();
        $sysdiagrams->name = $name;
        $sysdiagrams->principal_id = $principal_id;
        $sysdiagrams->diagram_id = $diagram_id;
        return $sysdiagrams;
    }

    /**
     * Constructor for sysdiagrams
     */
    public function __construct($uri = "")
    {
        $this->_objectID = Guid::NewGuid();        
        $this->_baseURI = $uri;
        
        $this->_entityKey[] = 'diagram_id';
    
    }

    /**
     * overring getObjectID() functon of Object class
     */
    public function getObjectID()
    {
        return $this->_objectID;
    }

    /**
     * This function returns the entity keys of this entity.
     */
    public function getEntityKeys()
    {
        return $this->_entityKey;
    }

    /**
     * This function set the entity keys of this entity.
     */
    public function setEntityKeys($entityKey)
    {
        $this->_entityKey = $entityKey;
    }

    /**
     * This function returns the related links of this entity.
     */
    public function getRelatedLinks()
    {
        return $this->_relLinks;
    }

    /**
     * This function set the related links of this entity.
     */
    public function setRelatedLinks($relLinks)
    {
        $this->_relLinks = $relLinks;
    }

    /**
     * Function for getting Entity Type Name corrosponding to navigation Name
     */
    public function getActualEntityTypeName($key)
    {
        if (array_key_exists  ($key, $this->_entityMap))
        {
            return ($this->_entityMap[$key]);
        }

        return $key;
    }
}
  
/**
 * Container class VideoGameStoreEntities, Namespace: VideoGameStoreModel
 */
class VideoGameStoreEntities extends ObjectContext
{
    /**
     * The constructor for VideoGameStoreEntities accepting service URI
     */
    public function __construct($uri = "")
    {
        if (strlen($uri) == 0)
        {
            $uri = DEFAULT_ADO_DOT_NET_SERVICE_URL;
        }
        
        if (Utility::reverseFind($uri, '/') != strlen($uri) - 1) 
        {
           $uri = $uri . '/';
        }

        $this->_baseURI = $uri;
        parent::ObjectContext($this->_baseURI);
        $this->_entities = array("Accessory", 
                                 "Console", 
                                 "Customer", 
                                 "Game", 
                                 "Product", 
                                 "ProductType", 
                                 "Purchase", 
                                 "PurchaseItem", 
                                 "Supplier", 
                                 "sysdiagrams");
        $this->_entitySet2Type = array("accessory" => "Accessory", 
                                 "console" => "Console", 
                                 "customer" => "Customer", 
                                 "game" => "Game", 
                                 "product" => "Product", 
                                 "producttype" => "ProductType", 
                                 "purchase" => "Purchase", 
                                 "purchaseitem" => "PurchaseItem", 
                                 "supplier" => "Supplier", 
                                 "sysdiagrams" => "sysdiagrams");
        $this->_entityType2Set = array("accessory" => "Accessory", 
                                 "console" => "Console", 
                                 "customer" => "Customer", 
                                 "game" => "Game", 
                                 "product" => "Product", 
                                 "producttype" => "ProductType", 
                                 "purchase" => "Purchase", 
                                 "purchaseitem" => "PurchaseItem", 
                                 "supplier" => "Supplier", 
                                 "sysdiagrams" => "sysdiagrams");
    }

    /**
     * Functions for adding object to the entityset/collection
     */
    
    /**
     * Add Accessory
     */
    public function AddToAccessory($object)
    {
        return parent::AddObject('Accessory', $object);
    }
    
    /**
     * Add Console
     */
    public function AddToConsole($object)
    {
        return parent::AddObject('Console', $object);
    }
    
    /**
     * Add Customer
     */
    public function AddToCustomer($object)
    {
        return parent::AddObject('Customer', $object);
    }
    
    /**
     * Add Game
     */
    public function AddToGame($object)
    {
        return parent::AddObject('Game', $object);
    }
    
    /**
     * Add Product
     */
    public function AddToProduct($object)
    {
        return parent::AddObject('Product', $object);
    }
    
    /**
     * Add ProductType
     */
    public function AddToProductType($object)
    {
        return parent::AddObject('ProductType', $object);
    }
    
    /**
     * Add Purchase
     */
    public function AddToPurchase($object)
    {
        return parent::AddObject('Purchase', $object);
    }
    
    /**
     * Add PurchaseItem
     */
    public function AddToPurchaseItem($object)
    {
        return parent::AddObject('PurchaseItem', $object);
    }
    
    /**
     * Add Supplier
     */
    public function AddToSupplier($object)
    {
        return parent::AddObject('Supplier', $object);
    }
    
    /**
     * Add sysdiagrams
     */
    public function AddTosysdiagrams($object)
    {
        return parent::AddObject('sysdiagrams', $object);
    }
    

    /**
     * This function returns the entities.
     */
    public function getEntities()
    {
        return $this->_entities;
    }
}

?>